Quantization control for variable bit depth

ABSTRACT

The quantization parameter QP is well-known in digital video compression as an indication of picture quality. Digital symbols representing a moving image are quantized with a quantizing step that is a function QSN of the quantization parameter QP, which function QSN has been normalized to the most significant bit of the bit depth of the digital symbols. As a result, the effect of a given QP is essentially independent of bit depth a particular QP value has a standard effect on image quality, regardless of bit depth. The invention is useful, for example, in encoding and decoding at different bit depths, to generate compatible, bitstreams having different bit depths, and to allow different bit depths for different components of a video signal by compressing each with the same fidelity (i.e., the same QP).

This application is a continuation of, and claims the benefit ofpriority to, U.S. patent application Ser. No. 13/216,836 filed on Aug.24, 2011, which is a continuation of U.S. patent application Ser. No.11/128,125 filed on May 11, 2005 (and issued as U.S. Pat. No. 8,045,614on Oct. 25, 2011), which claims the benefit of the filing date of U.S.Provisional Patent Application Ser. No. 60/573,017 filed on May 19,2004, all of which are hereby incorporated by reference in theirentirety.

FIELD OF THE INVENTION

This invention relates to digital methods for data compressing movingimages, and, in particular, to lossy methods that utilize quantizationto control the balance between the degree of compression and thefidelity of the compressed result. The invention includes not onlymethods but also corresponding computer program implementations andapparatus implementations.

BACKGROUND OF THE INVENTION

A digital representation of still or video images consists of spatialsamples of image intensity and/or color quantized to some particular bitdepth. This bit depth is typically dependent upon the devices used tocapture and display the still or video images. The dominant bit depthfor still and video images has been 8 bits. This provides reasonableimage quality and each sample fits perfectly into a single byte ofdigital memory.

Consequently, almost all image and video compression systems have beenlimited to 8-bit samples. For example, JPEG is specified only for 8-bitsamples of R/G/B and MPEG-2 is specified only for 8-bit samples ofY/U/V. However, 8 bits is certainly not the limit imposed by humanvision, and many applications require more fidelity than 8-bit samplescan provide. For the case of images captured on film, professionalscanners use 10-12 bits in approximately logarithmic units or roughly14-16 bits linear. Professional video systems routinely require 10-bitdata formats. Furthermore, an evolution to bit depths greater than 8bits is coming to consumers in general. The next version of Microsoft'soperating system, code-named Longhorn, is expected to have a new 10-bitper component display interface. In addition, modern compressiontechniques, such as JPEG2000 and H.264 are more efficient and have fewerartifacts than their predecessors. This makes them capable ofcompressing higher quality images without artifacts that would negatethe benefits of greater bit depths. Also, the ever-increasing bandwidthof wireless and wired networks allows transporting video of largerformat and higher quality. Taken together, this means that compressionat higher quality levels is efficient enough to be practical. Thus,there is an emerging need for compression systems that operate withsamples whose bit depth is greater than 8 bits.

Such greater bit depths allow higher fidelity in the overallcompression. The fidelity of a compressed image is measured by thedistortion, which is the mean-squared error (MSE) between the originalimage or frame and the reconstructed (compressed) image or framenormalized to the maximum possible (peak) amplitude and measured inlogarithmic units. In short, the distortion PSNR (Peak Signal-to-NoiseRatio) in dB isPSNR=10 log(peak² /MSE)  (1)Greater bit depths permit higher values for PSNR. For example, thequantization error for N-bit sampling is commonly modeled asindependent, uniformly distributed random noise over the interval [−½,½] so that the MSE is 1/12 with respect to the least significant bit.Since the input samples are integers in the range [0, 2^(N)−1], the peakvalue is 2^(N)−1. The PSNR corresponding to this MSE isPSNR=10 log((2^(N)−1)²/( 1/12))  (2)Since this represents the error between the original, unquantized imageand its quantized representation, it represents an upper bound for thefidelity of the compressed result compared to the original image. Table1 shows this upper bound for some representative bit depths:

TABLE 1 Maximum PSNR as a function of bit depth PSNR limit (dB) bitdepth (bits) (due to round-off) 8 58.92 10 70.99 12 83.04 14 95.08 16107.12

All lossy compression systems, such as the example schematically shownin FIG. 1, incur some form of a trade-off between the degree ofcompression (the number of compressed bits in the case of a still imageand the bit rate in the case of moving images) and the fidelity. Thisperformance is formally characterized by a “rate-distortion” (R-D)curve. This curve is a graph of the distortion (in PSNR) as a functionof the bits or bit rate required for the compressed representation(typically in Kbytes for images and Mbits/sec for moving images orvideo). FIG. 5 shows an example of a typical R-D curve. Rate-distortioncurves show how well a particular compression-decompression system, or“codec,” performs over a range of compression ratios or bit rates for aparticular input image or video sequence.

FIG. 1 shows schematically a generic prior art imagecompression/decompression system in which an original image is appliedto an Encoder 2. The encoder's compressed bits output are applied to aDecoder 4 that produces a decompressed version of the image. Theoriginal image is compared to the decompressed image in a PSNRcalculation 6 to provide the PSNR.

The method used to control where along the rate-distortion curve acompression system operates is through the use of a quantizationparameter, or QP, to control quantization as indicated in FIGS. 4 and 5,which figures are described further below. The parameter QP determinesthe quantization step-size, QS, which is then directly used inquantization and dequantization functions or devices. The most generalinterpretation is that an integer QP is used to index a table of valuesfor QS. Such a table contains a mapping from QP to QS. Thus, in FIG. 4,which shows schematically a generic prior art quantization anddequantization system, the quantization parameter QP is applied to afirst mapping function 10 that generates a corresponding quantizationstep-size QS in accordance with predetermined mapping relationships. Thesame QP value is also applied to a second mapping function 12 thatgenerates the same corresponding quantization step-size QS in accordancewith the same predetermined mapping relationships. The quantizationstep-size QS produced by mapping function 10 controls the step size ofquantizer 14 that receives an N-bit data word X. Quantizer 14 produces aquantized data word Q having a bit length that is a function of N, thequantization parameter QP, and the quantization step-size QS.Dequantizer 16 receives the quantized data word Q along with QS andproduces a dequantized N-bit data word X′ that approximates the inputN-bit data word X.

FIG. 5, shows a rate-distortion curve (distortion PSNR versus bit rateas QP is varied) for a hypothetical codec that employs both an identitymapping (QP=QS), such as that employed in prior art MPEG-1, MPEG-2 andMPEG-4 systems, and an exponential mapping, such as that employed in theH.264 system (QS=2^(QP/6−L)). The distribution of quantizationparameters QP is shown along the curve. The QP values above the curveare those for the identity mapping and the QP values below the curve arethose for the exponential mapping. For identity mapping, low values ofQP (indicating higher quality coding) are relatively sparse, becomingdenser for high values of QP (lower quality coding). For exponentialmapping, more values of QP are available for low values of QP and thedistribution of QP values is more uniform than for the identity mapping.

FIG. 2 and FIG. 3 show block diagrams for an H.264 encoder and decoder,respectively. H.264, also known as MPEG-4/AVC, is considered thestate-of-the-art in modern video coding. Although H.264 possesses manyof the features common to previous MPEG (ISO) and ITU video codecs, ithas many innovations. Although aspects of the present invention areusable in MPEG-1, MPEG-2 and MPEG-4 coding environments, aspects of thepresent invention may be used with particular advantage in H.264 codingenvironments. Details of H.264 coding are set forth in “Draft ITU-TRecommendation and Final Draft International Standard of Joint VideoSpecification (ITU-T Rec. H.264|ISO/IEC 14496-10 AVC),” Joint Video Team(JVT) of ISO/IEC MPEG & ITU-T VCEG (ISO/IEC JTC1/SC29/WG11 and ITU-TSG16 Q.6), 8^(th) Meeting: Geneva, Switzerland, 23-27 May, 2003. Detailsof the “Fidelity Range Extensions” to the basic H.264 specifications areset forth in “Draft Text of H.264/AVC Fidelity Range ExtensionsAmendment,” Joint Video Team (JVT) of ISO/IEC MPEG & ITU-T VCEG (ISO/IECJTC1/SC29/WG11 and ITU-T SG16 Q.6), 11^(th) Meeting: Munich, Del., 15-19Mar., 2004. Both of the just-identified documents are herebyincorporated by reference in their entireties. The “Fidelity RangeExtensions” will support higher-fidelity video coding by supportingincreased sample accuracy, including 10-bit and 12-bit coding. Aspectsof the present invention are particularly useful in connection with theimplementation of such increased sample accuracy. Further detailsregarding the H.264 standard and its implementation may be found invarious published literature, including, for example, “The emergingH.264/AVC standard,” by Ralf Schäfer et al, EBU Technical Review,January 2003 (12 pages) and “H.264/MPEG-4 Part 10 White Paper: Overviewof H.264,” by Iain E G Richardson, Jul. 10, 2002, published atwww.vcodex.com. Said Schäfer et al and Richardson publications are alsoincorporated by reference herein in their entirety.

The H.264 encoder shown in FIG. 2 has elements now common in videocoders: transform and quantization methods, entropy (lossless) coding,motion estimation (ME) and motion compensation (MC), and a buffer tostore reconstructed frames. H.264 differs from previous codecs in anumber of ways: an in-loop deblocking filter, many modes forintra-prediction, a new integer transform, two modes of entropy coding(variable length codes, and arithmetic coding), motion block sizes downto 4×4 pels, and so on. Of particular importance here is that H.264 hasa different distribution of quantization step-sizes that makes itsextension to higher bit depths more efficient than MPEG-2, for example.The outlined portion of FIG. 2 relates to the description of FIG. 7 a,below.

The H.264 decoder shown in FIG. 3 can be readily seen as a subset of theencoder. The new quantization methods forming aspects of the presentinvention apply to both the decoder and the encoder. The outlinedportion of FIG. 3 relates to the description of FIG. 7 b, below.

All lossy image and video compression systems, including H.264 and allthe other JPEG/MPEG/ITU standards, use quantization as the primary meansto control the degree of compression, and hence the fidelity of theresult. In other words, the degree of quantization used determines theoperating point along the rate-distortion curve. This may be seen, forexample, in FIG. 5.

The most common form of quantization is uniform (linear) quantization.MPEG-2 employs uniform quantization. In uniform quantization thequantized value is the original value scaled by a quantization step size(whose inverse is called the quantization resolution), QS, and convertedto an integerQ=int[X/QS+r]  (3)where X is the continuous variable to be quantized, Q is the quantizedvalue, and r is an optional rounding parameter in the interval [0,1). Ifr is 0, the quotient is truncated. If r is ½, the result corresponds tosimple rounding. Other values of r are possible and useful. Thecorresponding dequantized value isX′=Q×QS+s  (4)where s is another rounding parameter, so that X′ is the quantizedapproximation to X. As described above, FIG. 4 shows this prior art inquantization and dequantization. Note that the number of bits used forthe input, X, and the number of bits for the output, X′, are the sameand there is a single quantization step-size, QS.

As discussed above, the method used to control where along therate-distortion curve a compression system operates is through the useof a quantization parameter, or QP, to control quantization as indicatedin FIGS. 4 and 5. The parameter QP determines the quantizationstep-size, QS, which is then directly used in the quantization anddequantization equations 3 and 4 (above). The most generalinterpretation is that an integer QP is used to index a table of valuesfor QS. This table contains the mapping from QP to QS. There are twocommon mappings from

QP to QS: an identity mapping (used in MPEG-2 and other standards)QS=QP  (5)and an exponential mappingQS=2^(QP/6−L)  (6)which is used in H.264 (the value of L differs for quantizing lumaversus chroma in this standard). Note that the quantization step-size isan integer for the identity mapping, while for the exponential mappingit is a floating-point number approximated by an integer. Moreprecisely, in H.264, QS is represented by one of six integers, {2^(M),2^(M+1/6), . . . , 2^(M+5/6)}, for some value of M plus a number ofshifts necessary to account for the difference between M and the integerportion of (QP/6) and L.

The identity and exponential mappings distribute quantization step-sizesvery differently. The identity mapping is sparse for low QP values, butdense for high QP values, as indicated in FIG. 5. In contrast, thedensity of QP values for H.264 is more uniform. Table 2 compares thesetwo mappings for each factor of two (octave) in quantization step-size.“QS#” is the number of quantization step sizes in the octave. Thisinformation may also be seen in FIG. 5. As shown in the table and in thefigure, QP values of 1, 2, 4, 8, 16 and 32 for identity mappingcorrespond, respectively, to QP values of 0, 6, 12, 18, 24 and 30 forexponential mapping.

TABLE 2 Distribution of quantization step-sizes Identity MappingExponential Mapping Octave QS# {QP values} QS# {QP values} 1 1 {1}    6{0-5}  2 2 {2-3}  6 {6-11}  3 4 {4-7}  6 {12-17} 4 8 {8-15} 6 {18-23} 516 {16-31} 6 {24-29} 6 1 {32}  6 {30-35} 7 — 6 {36-41} 8 — 6 {42-47} 9 —5 {48-52}

The exponential mapping has the same density of quantization step-sizesfor each octave. FIG. 5 shows how these two compare for a hypotheticalrate-distortion plot (“hypothetical” in the sense that no existing codecis known to use both mappings). As mentioned above, the identity mappingis relatively sparse for low QPs, and very dense for high QPs, while theexponential mapping is relatively uniform for all QPs. As discussedfurther below, this makes the extension of quantization to higher bitdepth much more efficient for H.264 with its exponential mapping thanwith the identity mapping of MPEG-2.

The prior art does nothing to normalize the effects of varying bit depthwhen performing quantization and dequantization operations. That is, theprior art simply uses equation (3) with equations (5) or (6) forquantization, and equation (4) for dequantization, without anymodification for bit depth. This was the approach taken in the MPEG-4N-Bit and Studio video compression profiles, which were designed toencode bit depths of up to 12 bits. However, because no changes weremade to the quantization and dequantization methods when bit depthchanges, the same value for QP produces different values for PSNR atdifferent bit depths. What causes this is discussed below in connectionwith prior art quantization methods (and Table 3). At this point, theeffects are set forth.

Suppose that for the MPEG-2 N-Bit profile a particular value of QPresults in a PSNR of 40 dB at an 8-bit encoding depth; at a 10-bitencoding depth the same QP will result in a PSNR of roughly 52 dB. Thischange in PSNR reflects underlying differences in the codedbitstream—the number of bits in each quantized word in the bitstream isgreater in the case of the 10-bit encoding depth. In order to have thesame PSNR and the same quantized word lengths in the bitstream, the10-bit QP would have to be four times as large. These differences makeit more difficult to design encoders and decoders that can handledifferent bit depths, even though the 8-bit compression at QP and the10-bit compression at 4 times that QP produce nearly identicalcompressed data—the quantized word lengths are the same but theunderlying data represented by them may differ by a rounding difference.Thus, for a given QP value, the syntax and semantics of the bitstreamproduced by current encoders is not compatible for different bit depths.It would be advantageous to standardize QP parameters and quantizedvalues among different bit depths. For the prior art, a compressedbitstream generated from 10-bit data using a 10-bit encoder will notplay on current 8-bit decoders because QP and all the quantized valuesmean different things at different bit depths.

SUMMARY OF THE INVENTION

In a first aspect, the invention provides a method for digital encodingand decoding, comprising (1) processing digital symbols representing amoving image, each symbol S having a bit depth N, to provideintermediate variables X, each having a bit depth N+K, where K is afunction of the processing, (2) quantizing each intermediate variable Xwith a quantizing step size QS_(N) to produce a quantized data word Q,wherein QS_(N) is a function of a quantization parameter QP, whichfunction has been normalized to the most significant bit of the N-bitbit depth, (3) processing, including entropy coding, the quantized datawords Q to provide an encoded bitstream, (4) processing, includingentropy decoding, the encoded bitstream, to provide quantized data wordsQ, (5) dequantizing each quantized data word Q with a dequantizationstep size QS_(M) to produce a dequantized intermediate (M+K)-bitvariable X′ that approximates the intermediate (N+K)-bit variable X,wherein QS_(M) is the same function of the quantization parameter QP asis QS_(N) but has been normalized to the most significant bit of anM-bit bit depth, and (6) processing the intermediate variables X′ toproduce digital symbols, each symbol S′ having a bit depth M,representing an approximation of the moving image.

In another aspect, the invention provides for a method for producing anencoded bitstream in response to digital symbols representing a movingimage, comprising (1) processing the digital symbols, each symbol Shaving a bit depth N, to provide intermediate variables X, each having abit depth N+K, where K is a function of the processing, (2) quantizingeach intermediate variable X with a quantizing step size QS_(N) toproduce a quantized data word Q, wherein QS_(N) is a function of aquantization parameter QP, which function has been normalized to themost significant bit of the N-bit bit depth, and (3) processing,including entropy coding, the quantized data words Q to provide anencoded bitstream having the same syntax and semantics for a givenquantization parameter QP regardless of the bit depth N.

In a further aspect, the invention provides for another method forproducing an encoded bitstream in response to digital symbolsrepresenting a moving image, comprising (1) processing the digitalsymbols, each symbol S having a bit depth N, to provide intermediatevariables X, each having a bit depth N+K, where K is a function of theprocessing, (2) quantizing each intermediate variable X with aquantizing step size QS_(N) to produce a quantized data word Q, whereinQS_(N) is a function of a quantization parameter QP, which function hasbeen normalized to the most significant bit of the N-bit bit depth, and(3) processing, including entropy coding, the quantized data words Q toprovide an encoded bitstream wherein the portions of the bitstreamrepresenting the quantized data words Q are substantially identical fora given quantization parameter QP regardless of the bit depth N,differing by rounding errors between respective ones of the intermediatevariables X and the quantized data words Q for different bit depths N.

In yet another aspect, the invention provides for a method for digitalencoding, comprising processing digital symbols representing a movingimage, each symbol S having a bit depth N, to provide intermediatevariables X, each having a bit depth N+K, where K is a function of theprocessing, and quantizing each intermediate variable X with aquantizing step size QS_(N) to produce a quantized data word Q, whereinQS_(N) is a function of a quantization parameter QP, which function hasbeen normalized to the most significant bit of the N-bit bit depth.

In yet a further aspect, the invention provides for a method for digitalencoding and decoding, comprising (1) processing digital symbolsrepresenting a moving image, each symbol S having a bit depth Nc, whereNc is a function of the color component c, where c represents one of thecolor components RGB or YUV or equivalent, to provide intermediatevariables Xc, each having a bit depth Nc+K, where K is a function of theprocessing, (2) quantizing each intermediate variable Xc with aquantizing step size QS_(Nc) to produce a quantized data word Qc,wherein QS_(Nc) is a function of a quantization parameter QP, whichfunction has been normalized to the most significant bit of the Nc-bitbit depth, (3) processing, including entropy coding, the quantized datawords Qc to provide an encoded bitstream, (4) processing, includingentropy decoding, the encoded bitstream, to provide quantized data wordsQc, (5) dequantizing each quantized data word Qc with a dequantizationstep size QS_(Mc) to produce a dequantized intermediate (Mc+K)-bitvariable Xc′ that approximates the intermediate (Nc+K)-bit variable Xc,where Mc is also a function of the color component c, wherein QS_(Mc) isthe same function of the quantization parameter QP as is QS_(Nc) but hasbeen normalized to the most significant bit of an Mc-bit bit depth, and(6) processing the intermediate variables Xc′ to produce digitalsymbols, each symbol S′ having a bit depth Mc, representing anapproximation of the moving image.

In still another aspect, the invention provides for a method fordecoding a bitstream wherein the bitstream was generated by processingdigital symbols representing a moving image, each symbol S having a bitdepth N, to provide intermediate variables X, each having a bit depthN+K, where K is a function of the processing; quantizing eachintermediate variable X with a quantizing step size QS_(N) to produce aquantized data word Q, wherein QS_(N) is a function of a quantizationparameter QP, which function has been normalized to the most significantbit of the N-bit bit depth; and processing, including entropy coding,the quantized data words Q to provide an encoded bitstream, comprising(1) processing, including entropy decoding, the encoded bitstream, toprovide quantized data words Q, (2) dequantizing each quantized dataword Q with a dequantization step size QS_(M) to produce a dequantizedintermediate (M+K)-bit variable X′ that approximates the intermediate(N+K)-bit variable X, wherein QS_(M) is the same function of thequantization parameter QP as is QS_(N) but has been normalized to themost significant bit of an M-bit bit depth, and (3) processing theintermediate variables X′ to produce digital symbols, each symbol S′having a bit depth M, representing an approximation of the moving image.

Other aspects of the invention include apparatus adapted to perform themethods of any one of the aspects of the invention just described andcomputer programs, stored on a computer-readable medium for causing acomputer to perform the methods of any one of the aspects of theinvention just described.

Aspects of the present invention provide for uniform bitstream syntaxand semantics, independent of the bit depth.

Another aspect of the present invention is that the effect of a given QPshould be essentially independent of bit depth. In other words, aparticular QP value should have a standard effect on image quality,regardless of bit depth. This may be referred to as “QP invariance” andit may be achieved by normalizing the quantization step-size QS to themost significant bit of the bit depth of the variable being quantized.By doing nothing different as bit depth changes, previous imageprocessing methods normalize the quantization step-size to the leastsignificant bit of the bit depth of the variable being quantized.

Once the effects of QP are standardized with respect to the bit depthsof the input samples, it is easier to allow the bit depth of individualcolor components to be different from each other. Formats with differentbit depths for different color components are quite common, often aresult of the sensitivity of human vision to different colors. Forexample, the 5/6/5 RGB format uses 5 bits for Red, 6 bits for Green, and5 bits for Blue, which fits exactly into a 16-bit word and representsthe important green color with higher fidelity. If one attempts to usesuch color formats with existing compression systems, it would compressthe different color components with vastly differing fidelity. Thiscould be remedied by adding separate QP parameters for each component,for example QP_(R), QP_(G), QP_(B). However, current standards for videocompression do not allow this. This invention facilitates the nativecompression and decompression for these color formats that have unequalbit depths. Formats with unequal bit depths can also arise from colorspace transformations. Malvar and Sullivan have described alifting-based transformation between RGB at N/N/N bits and YCoCg atN/N+1/N+1 bits, which is exactly invertible using integer arithmetic. H.Malvar and G. Sullivan, “YCoCg-R: A Color Space with RGB Reversibilityand Low Dynamic Range,”,” ISO/IEC JTC1/SC29/WG11 and ITU-T SG16 Q.6document JVT-I014r3, July 2003. Thus, the ability to code YCoCg atunequal bit depths allows the indirect coding of N-bit RGB data withoutany fidelity loss from the color space transformation. Thus, it is afurther aspect of the invention to allow different bit depths fordifferent components of a video signal and to compress each with thesame fidelity (i.e., the same QP).

It is a further aspect of the present invention to produce a singlecompressed representation for any given value of QP that can be decoded,at least approximately (e.g., subject to round off errors), at anydesired bit depth. With this invention, it no longer necessary to havedifferent bitstreams that are incompatible because of bit depth. Bystandardizing the effects of QP, two decoders at different bit depthsperform the identical calculations but with differing precision. Withoutthis standardization, decoders require determining the meaning of QPwith respect to the bit depth of the encoder versus the bit depth of thedecoder.

Another aspect of the invention is that one may encode the image orvideo input at its native (original) bit depth and decoding may takeplace at whatever bit depth is desired or possible. While this mayresult in small drift between an N-bit decoding and an M-bit decoding ifthe decoded bit depth is greater than the encoded bit depth, such driftmay not be noticeable for common coding situations.

The invention is designed so that the rate-distortion performance of acompression system is independent of the bit depth of the data that isencoded. Therefore, the rate-distortion performance at a given QP shouldbe the same (within the limits of round-off error) regardless of bitdepth. This is achieved by normalizing the quantization step-size, QS,to the most significant bit of the data to be encoded. Thus thequantization step-size, QS, is a function of both the quantizationparameter, QP, and the number of bits used in data being encoded asshown in FIG. 6.

DESCRIPTION OF THE DRAWINGS

FIG. 1 shows schematically a generic prior art imagecompression/decompression system.

FIG. 2 shows a block diagram for an H.264 encoder.

FIG. 3 shows a block diagram for an H.264 decoder.

FIG. 4 shows prior art in quantization and dequantization.

FIG. 5 shows a rate-distortion curve.

FIG. 6 shows schematically a generic quantization and dequantizationsystem in accordance with aspects of the present invention.

FIGS. 7( a) and 7(b) show schematically a generic depiction of a videoencoder and decoder, respectively, showing how quantization anddequantization aspects of the present invention may be employed in suchencoders and decoders.

FIG. 8 shows schematically how higher bit depths add more negativevalues for QP.

FIG. 9 shows a rate-distortion curve.

DETAILED DESCRIPTION OF THE INVENTION

In a preferred embodiment, a quantization parameter, QP, determines thequantization step-size, QS. In order to achieve QP invariance as bitdepth changes, it is necessary to normalize QS with respect to the mostsignificant bit of the input data sample bit depth. If a given QP mapsto a quantization step-size QS₈ for 8-bit samples, then the resultingquantization step-size for N-bit samples isQS _(N) =QS ₈×2^(N−8)  (7)so that the basic quantization equation for N-bit samplesQ=int [X/QS _(N) +r]  (8)becomesQ=int[X×2^(8−N) /QS ₈ +r]  (9)Then dequantization for M-bit samplesX′=Q×QS _(N) +s  (10)becomesX′=2^(M−8) ×Q×QS ₈ +s  (11)Note that the implementation of these changes simply requires additionalshift operations with respect to the operations on 8-bit data. Althoughequations 7 through 11 may be expressed more generally, they areexpressed with respect to an 8-bit reference because 8-bit bit depthshave been common heretofore.

FIG. 6 shows schematically a generic quantization and dequantizationsystem in accordance with aspects of the present invention. Thequantization parameter QP is applied to a first mapping function 22 thatgenerates a quantization step-size QS_(N) in accordance withpredetermined QP to QS mapping relationships and a bit depth N. Thequantization step-size QS_(N) is determined in accordance with equation7 (above). N+K is the bit depth of the (N+K)-bit data words X applied toquantizer 24 that quantizes the X data words in accordance withstep-size QS_(N) to produce quantized data words Q having a bit lengththat is a function of QP, as discussed further below The same QP valueis also applied to a second mapping function 26 that generates aquantization step-size QS_(M) in accordance with the same predeterminedQP to QS mapping relationships but in response to a bit depth M that maybe different from the bit depth N to which mapping 22 is responsive. Bitdepth M+K is the bit depth of the (M+K)-bit data words produced bydequantizer 28. The dequantization step size QS_(M) is determined inaccordance with equation 7 (above). Dequantizer 28 receives thequantized data words Q and produces (M+K)-bit data words X′ thatapproximate the X data words.

FIG. 7 shows schematically a generic depiction of a video encoder anddecoder, such as the H.264 encoder and decoder shown in FIG. 2 and FIG.3, showing how quantization and dequantization aspects of the presentinvention may be employed in such encoders and decoders. For the encoderof FIG. 7( a), the block labeled “Process (Transformation)” transformsthe input samples into the variables to be quantized. This blockcorresponds generally to the portion of FIG. 2 enclosed by the dashedlines. The block labeled “Process (Entropy coding)” assembles an encodedbitstream after entropy coding the quantized variables. Similarly, forthe decoder in FIG. 7( b), the block labeled “Process (Entropydecoding)” parses encoded bitstream and entropy decodes theentropy-coded quantized variables. The block labeled “Process(Reconstruction)” reconstructs the output samples from the decoded anddequantized variables and corresponds generally to the portion of FIG. 3enclosed by the dashed line.

The encoder shown in FIG. 7( a) receives input symbols S of N bits andtransforms them into a sequence of variables X having N+K bits where Kis a function of the “Process (Transformation)” block and is typicallygreater than zero. The encoder is also provided with a QP value and thebit depth N of the input symbols S. Each variable X is quantized by aquantizing step-size QS_(N) appropriate for a sample bit depth of N.QS_(N) is determined by a mapping from QP to QS₈ followed by thenormalization given by equation 7. The resulting quantized variables areentropy coded and combined with N, QP and other parameters to produce anencoded bitstream. In practice, QP needs to be sent in the bitstreamonly when it changes. Sending N is useful for indicating that driftreduction is required if M<N or that emulation of lower precisionarithmetic in the decoder is required if M>N. N is required to indicatethe number of additional values of QP may be required. The encodedbitstream is decoded by the decoder shown in FIG. 7( b) to yield theoriginal N, QP, additional parameters and the quantized variables Q. Inthe decoder, these quantized variables are dequantized with aquantization step-size QS_(M) appropriate for M bit samples of thedesired output. QS_(M) is derived analogously to QS_(N) using a mappingfrom QP to QS₈ followed by the normalization to M bits given by equation7. The final output S′ is thus an M-bit approximation to the N-bitsamples S in the original image.

Fully utilizing the capabilities of greater bit depths requires smallervalues for the quantization step-size, QS. To achieve the improvedquality (the higher PSNR shown in Table 1) possible with greater bitdepths while maintaining QP invariance requires not only the retentionof existing values for QS but also requires additional values for QP toindicate the newly added finer values for QS. Retaining the existingvalues of QS may also require newly added intermediate values of QP, asis explained further below.

The prior art, by normalizing the quantization with respect to the leastsignificant bit, adds finer quantization step-sizes at the expense oflosing coarser values of QS as shown in Table 3. The example of Table 3pertains to identity mapping in which QP=QS. While the quantizationstep-sizes are the same with respect to the LSB for 8-bit and 10-bit bitdepths (QS₈ and QS₁₀ are the same value as QP for both bit depths in thecase of LSB normalization), they are not with respect to the MSB (forexample, 2⁻⁸ for QS₈ and 2⁻¹⁰ for QS₁₀ for QP=1 in the case of MSBnormalization). Thus the quantization step-sizes for 10 bits haveadditional fine values for QP=1,2,3, but sacrifice all the quantizationstep-sizes larger than 2⁻⁵ with respect to the MSB.

TABLE 3 Prior art quantization for identity mapping QS₈ QS₁₀ QP LSB(MSB) LSB (MSB) 1 1 (2⁻⁸)  1 (2⁻¹⁰) 2 2 (2⁻⁷) 2 (2⁻⁹) 3 3 3 4 4 (2⁻⁶) 4(2⁻⁸) . . . . . . . . . 8 8 (2⁻⁵) 8 (2⁻⁷) . . . . . . . . . 16  16(2⁻⁴)  16 (2⁻⁶)  . . . . . . . . . 32  32 (2⁻³)  32 (2⁻⁵) 

For this invention, the manner in which these new quantization stepsizes are added depends on the mapping from QP to QS introducedpreviously in equations (5) and (6).

In the case of the identity mappingQS=QP  (12)used in MPEG-2 and elsewhere this means that QP should now indicateadditional values for QS in order to exploit more fully the benefits ofgreater bit depths. For example, suppose that for 8-bit bit-depth, inputsamples the values for QP are the integers {1, 2, 3, 4 . . . K} andtherefore the values for QS are simply the same integers {1, 2, 3, 4 . .. K}. The quantization step-sizes for 10 bits that achieve QP invariance(for the original values of QP) are then the intermediate QS values {4,8, 12, 16 . . . 4×K}. This skips over the integers up to and betweenthose values, i.e., {1, 2, 3, 5, 6, 7, 9, 10, 11 . . . 4×K−2, 4×K−1}.Thus, to have all the possible integer quantization step-sizes at10-bits (i.e., all of the original step sizes and all of the new finerstep sizes), QP requires two extra “fractional” bits to indicate thevalues {¼, ½, ¾, 1, 1¼, 1½, 1¾, 2, . . . , K−¼, K}. An example of such arelationship between QP and QS at bit depths of 8 and 10 that achievesQP invariance is shown in Table 4.

TABLE 4 QP, and QS at 8 and 10 bits for identity mapping to achieve QPinvariance QP QS₈ QS₁₀ ¼ ¼ 1 ½ ½ 2 ¾ ¾ 3 1 1 4 1¼ 1¼ 5 . . . . . . . . .K − ¼ K − ¼ 4 × K − 1 K K 4 × K

The case of identity mapping requires determining the number offractional and integer bits in QP. One way to achieve this is to sendthe input bit depth, N, in the compressed bitstream. The number offractional bits in QP (and hence QS) is simply N-8.

The following two examples illustrate the quantization method accordingto aspects of the present invention for the case of identity mapping.Table 5 compares the coding of 10-bit data and the same data rounded to8-bits at QP=1 to show that the results agree as one would expect. Inpractice, one would not have to make a separate encoding at 8 bits,instead, one could encode at 10 bits and then decode at 8 or 10 bits.For a given value of QP, the quantization step-size, QS, changes withbit depth according to Equation (7). X is the data to be quantized,which, in this example, has two more bits than the input data, i.e.,K=2. Thus, what is referred to herein as the “8-bit X” has 10 (=N+K)bits. The 8-bit X is the 10-bit X rounded to 8 bits. Note that thequantized values Q are exactly the same because they are a function ofQP (in this example, a QP of 1 results in a quantized bit length of 10bits regardless of the bit depth). It is the equality, within roundingerror, of the quantized values Q that unifies operation for a givenvalue of QP at different bit depths, allowing the bitstreams fordifferent bit depths to be compatible for a given value of QP. Note thatthe dequantized values X′ are the same to within the rounding error(interpreting the 2 least significant bits of the 10-bit version asfractional bits when comparing to the 8-bit version). Thus,substantially the same quality results at different bit depths when QPhas the same value at the different bit depths.

TABLE 5 Comparing 8 and 10 bit encoding and decoding 8-bit encoding10-bit encoding Variable and decoding and decoding QP 1 1 QS 1 4 X0001110101 000111010011 Q 0001110101 0001110101 (assuming r = ½) X′0001110101 000111010100

Table 5 example shows that the quantized values, Q, always have the samescale regardless of bit depth for a given QP. This makes 8-bit and10-bit compressed bitstreams nearly identical in content, differing onlyto the extent of any rounding error. The respective bitstreams resultingfrom the same QP value thus may be identical in syntax and semanticseven though they represent different encoded bit depths.

The second example, in Table 6, compares 8- and 10-bit decoding at a QPof ¼, assuming an enhanced 8-bit decoder that can accept fractional QPs.In this case X′ differs by rounding error as one would expect.

TABLE 6 Comparing 8 and 10 bit decoding 10-bit encoding Variable 8-bitdecoding and decoding QP 1/4 1/4 QS 1/4 1 X . . . 000111010011 Q000111010011 000111010011 X′ 0001110101 (assuming s = ½) 000111010011Overall, the differences in dequantized values X′ are within roundingerror (Table 1). As in the Table 5 example, the number of bits requiredfor the quantized values, Q, is a function of QP, but not bit depth.Such results are due to the scaling for QS given in Equation 7 and aretrue independent of the mapping from QP to QS. In the Table 6 example,QP has a lower value, resulting in the potential of a higher qualitydecoded X′ (Q is 10 bits rather than 8 bits as in the Table 5 example,allowing a 10-bit decoding (or, if desired, an 8-bit decoding with aloss of resolution). For the case of 8-bit decoding, it is assumed thatthe encoder receives an input X having a bit depth of 10 bits (or more)in order to obtain a 10-bit quantized value Q in which the last twoleast significant bits are not zero.

For the case of the exponential mapping used in H.264,QS=2^(QP/6−L)  (13)making it necessary only to extend the range of QP in the negativedirection. The values for QP remain integers although they are nowsigned. Because of the QP/6 in the exponent, every additional bit ofsample bit depth allows the minimum value for QP to decrease by 6. Thusif the QP range for 8 bits is, say, [0, 51] then the QP range for 10bits would be [−12, 51]. In addition to QP remaining an integer, thismapping allocates QP values more efficiently than the identity mappingas was described earlier and shown in Table 2 and FIG. 5. Higher bitdepths enable higher quality, which occurs at lower values of QP. Theexponential mapping adds all these additional QP values in this range.FIG. 8 shows schematically how higher bit depths add more negativevalues for QP. We can now see why the exponential mapping provides amore efficient framework in which to add these new QP values. In goingfrom 8 to 10 bits, the identity mapping requires two extra bits torepresent QP but only adds three values, {¼, ½, ¾}, of smallerquantization step-sizes, with the other additional values filling inbetween existing QP values, most of which are at high QP (low quality)values. In contrast, with the exponential mapping each additional bit ofsample depth adds six smaller QP (and QS) values. Thus, going from 8 to10 bits adds 12 finer QS values for the exponential mapping while theidentity mapping adds only 3. Furthermore, it requires fewer bits tosignal these additional QP values. Using just one extra bit (the signbit) in the representation of QP is sufficient to handle a bit depth of16 bits.

These changes enable the possibility of compatible compressedbitstreams. Once the effects of bit depth are properly accounted for,the compressed representation is essentially independent of bit depth.That is, all control elements of the stream (such as QP) are exactly thesame. Numerical elements (such as quantized values, like Q) are the sameto within round-off error. Informational elements (such as the bitdepth, N) can differ. Consequently, decoders of differing bit depthssimply use more or less precision in their calculations. Examples ofdecoding at bit depths greater than encoded bit depths are give inUnited States Patent Publication US 2002/0154693 A1, of Gary A. Demos etal, published Oct. 24, 2002. Said Demos et al application is herebyincorporated by reference in its entirety.

The rate-distortion curve in FIG. 9 illustrates a fundamentalprinciple—that QP determines the overall system performance within theconstraints of the encoding and decoding bit depths. That is, QP, whichrepresents the quantization of the compressed data is the dominantcontroller of quality, while the bit depth, which represents thequantization of the input and output samples, only determines whether ornot the best performance possible for a given QP is achieved. Theoperating point indicated by “X” is at one QP and the two indicated by“Y” are at a different and smaller QP. The QP indicated by X yieldsessentially the same performance regardless of bit depth. Conversely,the performance at the QP indicated by Y is a case where the QP is solow that 10 bits are required to achieve the best possible PSNR.

Thus, it becomes possible, for example, to encode data at its originalor native (i.e., highest) bit depth, and then decode at any desired bitdepth. In this way, the original bit depth limits the quality of thedecompressed result, the decompressed bit depth, and the compressed bitrate in an optimal way.

FIG. 9 shows the resulting behavior. In this case, the original sourcematerial has a bit depth of 10 bits. This is encoded according toaspects of the present invention. This bitstream can then be decoded atboth the original 10 bits, as well as an approximate version at 8 bits.Note that at low bit rates the R-D curves for both cases are nearlyidentical. Then, as the rate-distortion curves approach the round-offthreshold for 8 bits (˜59 dB as shown in Table 1), the 8-bit curvebegins to fall away leaving only the 10-bit curve to achieve the higherPSNRs. The more limited range of QP values at 8 bits causes its curve toterminate at lower PSNR and bit rate.

As mentioned above, as 8-bit decoding of some quantized value differsonly from the corresponding 10-bit decoding by round-off error. Thisround-off error can accumulate from prediction to prediction, i.e.P-frames. This error results in a MSE between the 8-bit and 10-bitdecodings, which is known as drift. This drift typically is neithernoticeable nor objectionable in normal practice (i.e. I-frame spacing).In the case where the decoded bit depth, M, is greater than the input(encoding) bit depth, N, the resulting drift can be eliminated bysending N in the bitstream, and then emulating the coarser arithmetic ofan N-bit decoder.

Implementation

The invention may be implemented in hardware or software, or acombination of both (e.g., programmable logic arrays). Unless otherwisespecified, the algorithms included as part of the invention are notinherently related to any particular computer or other apparatus. Inparticular, various general-purpose machines may be used with programswritten in accordance with the teachings herein, or it may be moreconvenient to construct more specialized apparatus (e.g., integratedcircuits) to perform the required method steps. Thus, the invention maybe implemented in one or more computer programs executing on one or moreprogrammable computer systems each comprising at least one processor, atleast one data storage system (including volatile and non-volatilememory and/or storage elements), at least one input device or port, andat least one output device or port. Program code is applied to inputdata to perform the functions described herein and generate outputinformation. The output information is applied to one or more outputdevices, in known fashion.

Each such program may be implemented in any desired computer language(including machine, assembly, or high level procedural, logical, orobject oriented programming languages) to communicate with a computersystem. In any case, the language may be a compiled or interpretedlanguage.

Each such computer program is preferably stored on or downloaded to astorage media or device (e.g., solid state memory or media, or magneticor optical media) readable by a general or special purpose programmablecomputer, for configuring and operating the computer when the storagemedia or device is read by the computer system to perform the proceduresdescribed herein. The inventive system may also be considered to beimplemented as a computer-readable storage medium, configured with acomputer program, where the storage medium so configured causes acomputer system to operate in a specific and predefined manner toperform the functions described herein.

A number of embodiments of the invention have been described.Nevertheless, it will be understood that various modifications may bemade without departing from the spirit and scope of the invention. Forexample, some of the steps described above may be order independent, andthus can be performed in an order different from that described.Accordingly, other embodiments are within the scope of the followingclaims.

We claim:
 1. A method of processing an encoded bitstream of digitalsymbols representing a moving image, the encoded bitstream is entropyencoded by an encoder, the encoder identifying a bit depth M, the methodcomprising: receiving, by a decoder, the encoded bitstream, the encodedbitstream including a quantization parameter (QP), quantized digitalsymbols, and data identifying the bit depth M; and determining aquantization step size QS_(M) for the bit depth M, the quantization stepsize QS_(M) equaling 2^((M−N))*QS_(N) when the bit depth M is greaterthan a bit depth N, wherein QS_(N) is a quantization step size for thebit depth N according to the quantization parameter (QP), and whereinQS_(N)=2^(QP/6−L), L being a constant that differs for dequantizing lumavalues versus chroma values.
 2. The method of claim 1, wherein the bitdepth N equals
 8. 3. The method of claim 1, wherein the bit depth Mequals 10, 12, 14 or
 16. 4. The method of claim 1, wherein QS_(N) isdetermined by using the quantization parameter (QP) value to index atable of values.